<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>One-Admin - 后台登录</title>
    <meta name="keywords" content="One-Admin 后台管理">
    <meta name="description" content="One-Admin 后台管理">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__CSS__/style.css" rel="stylesheet">
    <link href="__CSS__/login.css" rel="stylesheet">
    <style>
        a {
            color: #3b99ea;
        }

        a:hover {
            color: #8ecbff;
        }
    </style>
</head>
<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7" style="color:#fff">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1> One-Admin </h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong>One-Admin 后台管理</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> bootstrap3模板</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> auth权限控制</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 行为日志采集</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 代码自动生成</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 更多功能持续开发中..</li>
                </ul>
                <strong>想要获取源码？ <a href="http://wpa.qq.com/msgrd?v=3&uin=1905957868&site=qq&menu=yes" target="_blank">联系开发人员»</a></strong>
            </div>
        </div>
        <div class="col-sm-5" style="color:#fff">
            <form id="loginForm" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
                <p class="m-t-md" id="err_msg">登录到后台</p>
                <input type="text" id="user_name" class="form-control uname" placeholder="用户名" name="user_name"/>
                <input type="password" id="password" class="form-control pword m-b" placeholder="密码" name="password"/>
                <div style="margin-bottom:70px">
                    <input type="text" class="form-control" placeholder="验证码"
                           style="color:black;width:50%;float:left;margin:0px 0px;" name="captcha"/>
                    <img id="captcha" src="{:captcha_src()}" alt="验证码"
                         style="height:34px; margin: 0 0 0 2%; width:48%; float:left; cursor: pointer"/>
                </div>
                <button type="submit" class="btn btn-primary btn-block">登　录</button>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left" style="color:#fff">
            &copy; 2016-2017 XingZi
        </div>
    </div>
</div>
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script src="__LIB__/ajaxform/jquery.form.js"></script>
<script src="__LIB__/layer/layer.js"></script>
<script>
    $(function () {
        $("#captcha").click(function () {
            $(this).attr("src", "{:captcha_src()}?t=" + new Date().getTime())
        });

        $('#loginForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function () {
                if ('' == $.trim($('#user_name').val())) {
                    layer.msg('请输入登录用户名', {icon: 5, time: 2000}, function (index) {
                        layer.close(index);
                    });
                    return false;
                }

                if ('' == $.trim($('#password').val())) {
                    layer.msg('请输入登录密码', {icon: 5, time: 2000}, function (index) {
                        layer.close(index);
                    });
                    return false;
                }
                $("button").removeClass('btn-primary').addClass('btn-danger').text("登录中...");
            },
            success: function (result) {
                console.log(result.msg);
                if (result.code == 1) {
                    layer.msg(result.msg, {icon: 6, time: 2000}, function (index) {
                        layer.close(index);
                        window.location.href = result.data.url;
                    });
                } else {
                    layer.msg(result.msg, {icon: 5, time: 2000});
                    $("button").removeClass('btn-danger').addClass('btn-primary').text("登　录");
                    $("#captcha").attr("src", "{:captcha_src()}?t=" + new Date().getTime());
                    return false;
                }
            }
        });
    });
</script>
</body>
</html>